package com.interceptor;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class MyHandler implements InvocationHandler {

	public Object object;

	public Interceptor interceptor = new Interceptor();

	public void setObject(Object object) {
		
		this.object = object;

	}

	public Object invoke(Object arg0, Method arg1, Object[] arg2)
			throws Throwable {

		Object result = null;

		interceptor.before();

		result = arg1.invoke(object, arg2);//arg2 是object的参数；

		interceptor.after();

		return result;
	}

}
